﻿Imports System.Web

Public NotInheritable Class SharedCalls

    Private Sub New()
    End Sub

    Public Shared ReadOnly Property PersonNameList As ArrayList
        Get
            Dim result As ArrayList = New ArrayList()
            result.Add("早餐")
            result.Add("午餐")
            result.Add("交通费")
            result.Add("其他")
            Return result
        End Get
    End Property

    Public Shared ReadOnly Property PersonTypeList As ArrayList
        Get
            Dim result As ArrayList = New ArrayList()
            result.Add("支出")
            result.Add("收入")
            Return result
        End Get
    End Property

    Public Shared Function TransactionNameList(ByVal owner As String) As ArrayList
        Dim result As ArrayList = New ArrayList()
        If owner = "IA" Then
            result.Add("日常支出&杂物")
            result.Add("供款")
            result.Add("固定费用")
            result.Add("娱乐&应酬")
            result.Add("远行")
            result.Add("其他")
        Else
            result.Add("早餐")
            result.Add("午餐")
            result.Add("交通费")
            result.Add("其他")
            result.Add("固定供款")
        End If
        Return result
    End Function

    Public Shared Function TransactionTypeList(ByVal owner As String) As ArrayList
        Dim result As ArrayList = New ArrayList()
        If owner = "IA" Then
            result.Add("垫付")
            result.Add("存入")
            result.Add("提款")
        Else
            result.Add("支出")
            result.Add("收入")
        End If
        Return result
    End Function

    Public Shared Function TransactionPayerList(ByVal owner As String) As ArrayList
        Dim result As ArrayList = New ArrayList()
        result.Add(owner)
        If owner = "IA" Then
            result.Add("Nicole")
            result.Add("Vincent")
            result.Add("Others")
        End If
        Return result
    End Function

    Public Shared Function Authorize(ByVal userName As String, ByVal password As String) As Boolean
        Return MysqlDataBaseConnection.RunSelect(
            String.Format("select * from user where user_name = '{0}' and password = '{1}';", userName, password)
            ).Tables(0).Rows.Count > 0
    End Function

End Class
